local ninggou = fk.CreateSkill{
  name = "hanqing__ninggou",
}

Fk:loadTranslationTable{
  ["hanqing__ninggou"] = "佞构",
  [":hanqing__ninggou"] = "出牌阶段，你可以对攻击范围内一名其他角色造成1点伤害，然后移动场上一张牌。若你场上牌数未因此减少，你失去〖佞构〗。",

  ["#hanqing__ninggou"] = "佞构：对攻击范围内一名角色造成1点伤害，然后移动场上一张牌！",
  ["#hanqing__ninggou-move"] = "佞构：请移动场上一张牌，若移动的不是你区域内的牌，你失去“佞构”！",
}

ninggou:addEffect("active", {
  anim_type = "offensive",
  prompt = "#hanqing__ninggou",
  card_num = 0,
  target_num = 1,
  can_use = Util.TrueFunc,
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected)
    return to_select ~= player and player:inMyAttackRange(to_select)
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:damage{
      from = player,
      to = target,
      damage = 1,
      skillName = ninggou.name,
    }
    if player.dead then return end
    local yes = true
    if #room:canMoveCardInBoard() > 0 then
      local targets = room:askToChooseToMoveCardInBoard(player, {
        prompt = "#hanqing__ninggou-move",
        skill_name = ninggou.name,
        cancelable = false,
      })
      local result = room:askToMoveCardInBoard(player, {
        target_one = targets[1],
        target_two = targets[2],
        skill_name = ninggou.name,
      })
      if result and result.from == player then
        yes = false
      end
    end
    if yes and not player.dead then
      room:handleAddLoseSkills(player, "-hanqing__ninggou")
    end
  end,
})

return ninggou
